package safrain.nodelet.pool;

import safrain.nodelet.structure.Structure;

/**
 * 同步的对象池，可以供多线程使用
 * 
 * @author safrain
 * 
 */
public class SynchronizedPool extends ObjectPool {
	public SynchronizedPool(Structure structure, int poolSize) {
		super(structure, poolSize);
	}

	private final byte[] lock = new byte[0];

	@Override
	public Object get() {
		synchronized (lock) {
			return super.get();
		}
	}

	@Override
	public void recycle(Object object) {
		synchronized (lock) {
			super.recycle(object);
		}
	}

}